<?php
class getImages {
$hostname = "localhost";
$username = "erhanerol";
$password = "erhanerol";

 

mysql_connect($hostname, $username, $password) or die ("<html><script language='JavaScript'>alert('Unable to connect to database'),history.go(-1)</script></html>");
mysql_select_db($username);

 public function getImageByUserName($username) {

	$query = "SELECT user_image FROM securitysystem.users WHERE 	securitysystem.users.username=$username";

 

	$result = mysql_query($query);

 

	$data = mysql_result($result, 0);

 

	$im = imagecreatefromstring($data);

 

	if ($im !== false) {
   	 header('Content-Type: image/jpg');
   	 imagejpg($im);
  	  imagedestroy($im);
	}
	else {
  	  echo 'An error occurred.';
	}
}
}

?>